<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JQ事件之事件冒泡</title>
</head>
<body>
    <div class="box">
        <button class="btn">点击</button>
    </div>

    <script src="./js/jquery.3.5.1.js"></script>
    <script>
        $(function(){
            // 默认允许事件冒泡
            $('.btn').on('click',function(){
                console.log('这是btn的事件触发');
            })
            $('.box').on('click',function(){
                console.log('这是box的事件触发');
            })
            $('body').on('click',function(){
                console.log('这是body的事件触发');
            })

            
            $('.btn').triggerHandler('click')
        })
    </script>
</body>
</html>